package com.qf.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.mapper.StudentMapper;
import com.qf.pojo.Student;
import com.qf.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class StudentServiceImpl  implements StudentService {

    @Autowired
    private StudentMapper studentMapper;

    @Transactional
    @Override
    public PageInfo<Student> page(int currentPage, int pageSize) {

        //设置分页参数
        PageHelper.startPage(currentPage,pageSize);

        //查询数据
        List<Student> students = studentMapper.findAll();

        return new PageInfo<>(students);
    }
}
